<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加网站</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${global_templets_skin}/systemstyle/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${global_templets_skin}/systemstyle/style/admin.css" media="all">
    <script charset="utf-8" src="${global_templets_skin}/kindeditor/kindeditor-all-min.js"></script>
    <script charset="utf-8" src="${global_templets_skin}/kindeditor/lang/zh-CN.js"></script>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">企业基本信息</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form" wid100 lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">公司名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="fullName" id="fullName" value="${company.fullName!}" lay-verify="required" placeholder="营业执照上的公司全称，如：北京某某科技有限公司" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">公司简称</label>
                            <div class="layui-input-block">
                                <div class="layui-input-inline">
                                    <input type="text" name="shortName" id="shortName" value="${company.shortName!}" lay-verify="required" placeholder="公司简称，如：腾讯" class="layui-input">
                                </div>
                                <div class="text-tips" id="domain-tips">用于企业账号对外沟通交流使用</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">企业头像</label>
                            <div class="layui-input-inline">
                                <input type="text" name="avatar" lay-verify="required" placeholder="请上传图片" autocomplete="off" class="layui-input">
                            </div>
                            <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传图片</button><input class="layui-upload-file" type="file" accept="image/*" name="file">
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">所属行业</label>
                            <div id="columnform"></div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">公司规模</label>
                            <div class="layui-input-block">
                                <select name="type" lay-verify="required" lay-filter="aihao">
                                    <option value="">请选择</option>
                                    <option value="1">5人以下</option>
                                    <option value="2">5-10人</option>
                                    <option value="3">11-50人</option>
                                    <option value="4">51-100人</option>
                                    <option value="5">101-200人</option>
                                    <option value="6">201-300人</option>
                                    <option value="7">301-500人</option>
                                    <option value="8">501-1000人</option>
                                    <option value="9">1000以上</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">经营模式</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="modeArray[1]" title="制造商">
                                <input type="checkbox" name="modeArray[2]" title="贸易商">
                                <input type="checkbox" name="modeArray[3]" title="服务商" checked>
                                <input type="checkbox" name="modeArray[4]" title="其他机构">
                                (最多可选2种)
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">公司介绍</label>
                            <div class="layui-input-block">
                                    <textarea name="introduce" id="introduce" class="layui-textarea"
                                              style="width:100%;height:300px;">${company.introduce!}</textarea>
                                <script>
                                    //装载编辑器
                                    KindEditor.ready(function (K) {
                                        K.create('#introduce',
                                            {
                                                uploadJson: '/member/kindEditorUpload',
                                                //fileManagerJson : '../asp/file_manager_json.asp',
                                                //allowFileManager : true,
                                                allowImageRemote: false,
                                                "filterMode": false,
                                                afterBlur: function () {
                                                    this.sync();
                                                }
                                            });
                                    });
                                </script>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">公司地址</label>
                            <div class="layui-input-block">
                                <select name="type" lay-verify="required" lay-filter="aihao">
                                    <option value=""></option>
                                    <option value="0">前端工程师</option>
                                    <option value="1">Node.js工程师</option>
                                    <option value="2">PHP工程师</option>
                                    <option value="3">Java工程师</option>
                                    <option value="4">运维</option>
                                    <option value="4">视觉设计师</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="id" id="id" value="${company.id!}">
                                <button class="layui-btn" lay-submit lay-filter="addCompany">确认保存</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="${global_templets_skin}/systemstyle/layui/layui.js"></script>
<script>
    layui.config({
        base: '${global_templets_skin}/systemstyle/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set'], function () {
        var form   = layui.form;
        var $      = layui.jquery;
        var layer  = layui.layer;

        form.on('submit(addCompany)', function(data) {
            $.ajax({
                url:'/member/company/info.do',
                type:'post',
                dataType: 'json',
                data: data.field,
                success:function(e){
                    if (e.code == "0") {
                        layer.msg(e.message);
                        window.location.reload();
                    }else {
                        layer.msg(e.message);
                    }
                }
            })
            //防止页面跳转
            return false;
        });

    });
</script>
</body>
</html>